package org.example.joinblog.util;
import java.security.SecureRandom;

public class CodeCreation {

    private static final String CHAR_SET = "0123456789";
    private static final int CODE_LENGTH = 6;

    public static String generateCode() {
        SecureRandom random = new SecureRandom();
        StringBuilder codeBuilder = new StringBuilder();
        for (int i = 0; i < CODE_LENGTH; i++) {
            int index = random.nextInt(CHAR_SET.length());
            codeBuilder.append(CHAR_SET.charAt(index));
        }
        return codeBuilder.toString();
    }

    public static void main(String[] args) {
        String verificationCode = generateCode();
        System.out.println("Generated Verification Code: " + verificationCode);
    }
}
